//
//  AddressModel.m
//  runtime
//
//  Created by dihuijun on 17/3/31.
//  Copyright © 2017年 Cycle. All rights reserved.
//

#import "AddressModel.h"
#import "AddressModel2.h"
@implementation AddressModel
///AddressModel2的元素归属于sub
+(NSDictionary *)mj_objectClassInArray
{
    return @{@"sub":@"AddressModel2"};
}
+ (NSDictionary *)mj_replacedKeyFromPropertyName
{
    //参数替换
    return @{@"myname":@"name"};
}

- (instancetype)initWithModelWithDict:(NSDictionary *)dict{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dict];
        
        NSMutableArray *resultArray = [NSMutableArray array];
        for (NSDictionary *dic in self.sub) {
            AddressModel2 *address = [AddressModel2 address2WithDict:dic];
            [resultArray addObject:address];
//            NSLog(@"%@",address.name);
        }
        self.sub  = resultArray;
    }
    return self;
}

+ (instancetype)resultModel1WithDict:(NSDictionary *)dict2{
    return [[self alloc]initWithModelWithDict:dict2];
}
@end
